package easy;

/**
 * @author admin
 * 1470. 重新排列数组
 */
public class LeeCode1470 {

    public int[] shuffle(int[] nums, int n) {
//        初始：1,2,3,4,4,3,2,1
//        结果：1,4,2,3,3,2,4,1
        int []res = new int[nums.length];
        for (int i = 0; i < n; i++) {
            res[i*2] = nums[i];
            res[i*2+1] = nums[i + n];
        }
        for (int re : res) {
            System.out.println(re);
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(new LeeCode1470().shuffle(new int[]{1, 2, 3, 4, 4, 3, 2, 1}, 4));
    }
}
